package uk.ac.cam.cl.projectcharlie2010.clients.desktop.gui;

import java.awt.BorderLayout;

import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.WindowConstants;

import uk.ac.cam.cl.projectcharlie2010.CharliesConstants;

import ch.nostromo.lib.swing.NosInternalFrame;

public class GeneralStatusFrame extends NosInternalFrame {

	  private static final long serialVersionUID = 1L;

	  private JTextArea generalStatus;

	  private JScrollPane scrollPane;
	  
	  private String previousStatusMessage;

	  public GeneralStatusFrame() {
	    super();
	    initGUI();
	  }

	  private void initGUI() {

	      BorderLayout thisLayout = new BorderLayout();
	      this.getContentPane().setLayout(thisLayout);
	      setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
	      this.setPreferredSize(new java.awt.Dimension(302, 250));
	      this.setBounds(0, 0, 302, 250);
	      {
	        scrollPane = new JScrollPane();
	        this.getContentPane().add(scrollPane, BorderLayout.CENTER);
	        {
	        	generalStatus = new JTextArea();
	          scrollPane.setViewportView(generalStatus);
	        }
	      }
	      pack();

	  }

	  public void setGeneralStatusMessage(String msg) {
		  previousStatusMessage = generalStatus.getText();
		  generalStatus.setText(msg);
	  }

	public void setArmMovingStatusMessage() {
		previousStatusMessage = generalStatus.getText();
		generalStatus.setText(CharliesConstants.ARM_MOVING);
	}
	
	public void revertGeneralStatusMessage() {
		generalStatus.setText(previousStatusMessage);
	}

	}
